


/*
'===============================================================================
'  HNG.Portal.BL.TblSiteMapManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Windows.Forms;
namespace HNG.Portal.BLL
{
	public class TblSiteMapManagerBase
	{
	    
		#region ColumnNames
		
				public const String Field_Id="Id";
				
				public const String Field_Title="Title";
				
				public const String Field_Description="Description";
				
				public const String Field_Url="Url";
				
				public const String Field_Roles="Roles";
				
				public const String Field_Parent="Parent";
				
				public const String Field_Type="Type";
				
				public const String Field_Oders="Oders";
				
				public const String Field_Status="Status";
				
		#endregion	
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		public TblSiteMapManagerBase()
		{
			// Nothing for now.
		}
		public DataTable Clone()
		{
			DataTable dt = new DataTable();
						
			
			dt.Columns.Add(Field_Id,typeof(int));
			
						
			
			dt.Columns.Add(Field_Title,typeof(string));
			
						
			
			dt.Columns.Add(Field_Description,typeof(string));
			
						
			
			dt.Columns.Add(Field_Url,typeof(string));
			
						
			
			dt.Columns.Add(Field_Roles,typeof(string));
			
						
			
			dt.Columns.Add(Field_Parent,typeof(int));
			
						
			
			dt.Columns.Add(Field_Type,typeof(string));
			
						
			
			dt.Columns.Add(Field_Oders,typeof(int));
			
						
			
			dt.Columns.Add(Field_Status,typeof(string));
			
			            
            return dt;			
		}
			
		public TblSiteMapEntity Convert_Entity(TblSiteMapEntity _TblSiteMapEntity,TblSiteMapEntity _TblSiteMapEntity_XML)
		{	
			
				
			_TblSiteMapEntity.Id= _TblSiteMapEntity_XML.Id;
				
			_TblSiteMapEntity.Title= _TblSiteMapEntity_XML.Title;
				
			_TblSiteMapEntity.Description= _TblSiteMapEntity_XML.Description;
				
			_TblSiteMapEntity.Url= _TblSiteMapEntity_XML.Url;
				
			_TblSiteMapEntity.Roles= _TblSiteMapEntity_XML.Roles;
				
			_TblSiteMapEntity.Parent= _TblSiteMapEntity_XML.Parent;
				
			_TblSiteMapEntity.Type= _TblSiteMapEntity_XML.Type;
				
			_TblSiteMapEntity.Oders= _TblSiteMapEntity_XML.Oders;
				
			_TblSiteMapEntity.Status= _TblSiteMapEntity_XML.Status;
				
			
			return _TblSiteMapEntity;
		}	
		
			
		public void InsertCollection(EntityCollection _Collection)
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                adapter.SaveEntityCollection(_Collection);
            }
		}

		public TblSiteMapEntity Insert(TblSiteMapEntity TblSiteMapEntity)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(TblSiteMapEntity, true);
			}
			return TblSiteMapEntity;
		}

		
		public TblSiteMapEntity Insert(int Id, string Title, string Description, string Url, string Roles, int Parent, string Type, int Oders, string Status)
		{
			TblSiteMapEntity _TblSiteMapEntity = new TblSiteMapEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblSiteMapEntity.Id = Id;
				_TblSiteMapEntity.Title = Title;
				_TblSiteMapEntity.Description = Description;
				_TblSiteMapEntity.Url = Url;
				_TblSiteMapEntity.Roles = Roles;
				_TblSiteMapEntity.Parent = Parent;
				_TblSiteMapEntity.Type = Type;
				_TblSiteMapEntity.Oders = Oders;
				_TblSiteMapEntity.Status = Status;
				adapter.SaveEntity(_TblSiteMapEntity, true);
			}
			return _TblSiteMapEntity;
		}

		public TblSiteMapEntity Insert(string Title, string Description, string Url, string Roles, int Parent, string Type, int Oders, string Status)
		{
			TblSiteMapEntity _TblSiteMapEntity = new TblSiteMapEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblSiteMapEntity.Title = Title;
				_TblSiteMapEntity.Description = Description;
				_TblSiteMapEntity.Url = Url;
				_TblSiteMapEntity.Roles = Roles;
				_TblSiteMapEntity.Parent = Parent;
				_TblSiteMapEntity.Type = Type;
				_TblSiteMapEntity.Oders = Oders;
				_TblSiteMapEntity.Status = Status;
				adapter.SaveEntity(_TblSiteMapEntity, true);
			}
			return _TblSiteMapEntity;
		}

		public bool Update(TblSiteMapEntity _TblSiteMapEntity)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(TblSiteMapFields.Id == _TblSiteMapEntity.Id);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_TblSiteMapEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}
		
		public bool Update(TblSiteMapEntity _TblSiteMapEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_TblSiteMapEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}

		public bool Update(int Id, string Title, string Description, string Url, string Roles, int Parent, string Type, int Oders, string Status)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblSiteMapEntity _TblSiteMapEntity = new TblSiteMapEntity(Id);
				if (adapter.FetchEntity(_TblSiteMapEntity))
				{
				
					_TblSiteMapEntity.Title = Title;
					_TblSiteMapEntity.Description = Description;
					_TblSiteMapEntity.Url = Url;
					_TblSiteMapEntity.Roles = Roles;
					_TblSiteMapEntity.Parent = Parent;
					_TblSiteMapEntity.Type = Type;
					_TblSiteMapEntity.Oders = Oders;
					_TblSiteMapEntity.Status = Status;
					adapter.SaveEntity(_TblSiteMapEntity, true);
					toReturn = true;
				}
			}
			return toReturn;
		}

		public bool Delete(int Id)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblSiteMapEntity _TblSiteMapEntity = new TblSiteMapEntity(Id);
				if (adapter.FetchEntity(_TblSiteMapEntity))
				{
					adapter.DeleteEntity(_TblSiteMapEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("TblSiteMapEntity", null);
			}
		}
		
		
		public int DeleteById(int Id)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTitle(string Title)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Title == Title);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByDescription(string Description)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Description == Description);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByUrl(string Url)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Url == Url);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByRoles(string Roles)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Roles == Roles);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByParent(int Parent)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Parent == Parent);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByType(string Type)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Type == Type);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByOders(int Oders)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Oders == Oders);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByStatus(string Status)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Status == Status);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblSiteMapEntity", filter);
			}
			return toReturn;
		}
		

		
		public TblSiteMapEntity SelectOne(int Id)
		{
			TblSiteMapEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblSiteMapEntity _TblSiteMapEntity = new TblSiteMapEntity(Id);
				if (adapter.FetchEntity(_TblSiteMapEntity))
				{
					toReturn = _TblSiteMapEntity;
				}
			}
			return toReturn;
		}

		// Return EntityCollection
		public EntityCollection SelectAll()
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection( new TblSiteMapEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, null, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}

		
		// Return EntityCollection
		public EntityCollection SelectById(int Id)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT(int Id)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTitle(string Title)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Title == Title);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTitleRDT(string Title)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Title == Title);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByDescription(string Description)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Description == Description);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByDescriptionRDT(string Description)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Description == Description);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByUrl(string Url)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Url == Url);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByUrlRDT(string Url)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Url == Url);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByRoles(string Roles)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Roles == Roles);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByRolesRDT(string Roles)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Roles == Roles);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByParent(int Parent)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Parent == Parent);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByParentRDT(int Parent)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Parent == Parent);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByType(string Type)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Type == Type);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTypeRDT(string Type)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Type == Type);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByOders(int Oders)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Oders == Oders);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByOdersRDT(int Oders)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Oders == Oders);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByStatus(string Status)
		{
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Status == Status);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblSiteMapCollection, filter, 0, null);
			}
			return _TblSiteMapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByStatusRDT(string Status)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblSiteMapCollection = new EntityCollection(new TblSiteMapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblSiteMapFields.Status == Status);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblSiteMapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		

	}
}
